package com.luminary.demo.user.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.luminary.component.eureka.client.provider.ServerInfoProvider;
import com.luminary.demo.user.meta.ServerInfo;

@Configuration
public class ServerConfiguration {
	
	@Bean
	@ConditionalOnMissingBean(value = ServerInfoProvider.class)
	public ServerInfoProvider serverInfoProvider() {
		
		return new ServerInfoProvider() {

			@Override
			public String getContextPath() {
				return ServerInfo.CONTEXT_PATH;
			}

			@Override
			public int getPort() {
				return ServerInfo.PORT;
			}

			@Override
			public String getApplicationName() {
				return ServerInfo.APPLICATION_NAME;
			}
			
		};
		
	}
	
}
